aboutsummaryrefslogtreecommitdiff
path: root/src/pages/[...path].tsx
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-10-23 02:10:32 +0300
committereug-vs <eugene@eug-vs.xyz>2022-10-23 02:10:32 +0300
commit9fe22ea6481754a4d68d9f01beb2c26412a2eb07 (patch)
tree131883704b96b30a8662e4cda61c76837a765068 /src/pages/[...path].tsx
parent6e6c4860d2dc3ff89b29878f196eda3e62d64486 (diff)
downloadbenzin-next-9fe22ea6481754a4d68d9f01beb2c26412a2eb07.tar.gz
feat: autolink headings
Diffstat (limited to 'src/pages/[...path].tsx')
-rw-r--r--src/pages/[...path].tsx5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pages/[...path].tsx b/src/pages/[...path].tsx
index 06ad09d..d37ec91 100644
--- a/src/pages/[...path].tsx
+++ b/src/pages/[...path].tsx
@@ -9,6 +9,8 @@ import remarkGemoji from 'remark-gemoji';
import benzinConfig from '../config';
import Code from '../Code';
import remarkGfm from 'remark-gfm';
+import rehypeSlug from 'rehype-slug';
+import rehypeAutolinkHeadings from 'rehype-autolink-headings';
const transformLinkUri = (uri: string): string => {
return uri.match(/(.*)\.md/)?.[1] || uri;
@@ -65,7 +67,8 @@ const Page: NextPage = ({ markdownSource, emojiFileNames }: any) => {
<ReactMarkdown
transformLinkUri={transformLinkUri}
transformImageUri={transformImageUri}
- rehypePlugins={[emojiPlugin(emojiFileNames), remarkGemoji, remarkGfm]}
+ rehypePlugins={[emojiPlugin(emojiFileNames), rehypeSlug, [rehypeAutolinkHeadings, { behavior: 'wrap' }]]}
+ remarkPlugins={[remarkGemoji, remarkGfm]}
components={{
emoji: Emoji,
img: Image,